<?php 
namespace app\admin\validate;
use think\validate;
class SuppliersValidate extends Validate{
    //验证规则
    protected $rule = array(
		'suppliers_name' => 'max:255',
    		'suppliers_contacts' => 'max:255',
		'suppliers_phone'=>'regex:^1[356789]\d{9}',
	);
    //验证失败提示信息
    protected $message = array(
		'suppliers_name.max'=>'供应商名称的值不能超过255个字符',
		'suppliers_contacts.max'=>'供应商联系人的值不能超过255个字符',
		'suppliers_phone.regex'=>'供应商名字的值不是正确的手机号码',
);
    //验证场景
    protected $scene = array(
		'add'=>array('suppliers_name','suppliers_desc','is_check','suppliers_contacts','suppliers_phone'),
		'edit'=>array('suppliers_id','suppliers_name','suppliers_desc','is_check','suppliers_contacts','suppliers_phone'),
	);

}